home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / ovrobj.com / OVR_OBJ.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1989-11-29  |  1.2 KB  |  32 lines

  1. unit Ovr_Obj;
  2.  
  3. "OBJitized" data (data that has been converted to an OBJ file with the BINOBJ
  4. utility) normally cannot be used in an overlayed unit. The function OvrObj
  5. circumvents this restriction, returning a pointer to the actual data, whether
  6. or not the unit is overlaid.  See OVROBJ.DOC for more information.
  7.  
  8. Written by Ron Schuster.  Copyright (c) 1989, Ron Schuster. All rights reserved.
  9. May be distributed freely, but not for a profit.
  10.  
  11. Version 1.0, 11/29/89
  12. --------------------
  13.   Initial release.
  14. }
  15.  
  16. interface
  17.  
  18. function OvrObj (X : Pointer) : Pointer;
  19.   inline ($58/                          { pop ax           ; Offset part of X  }
  20.           $07/                          { pop es           ; Segment part of X }
  21.           $26/$81/$3e/$00/$00/$cd/$3f/  { cmp es:word ptr [0],3FCD ; Overlaid? }
  22.           $75/$06/                      { jne NotOverlayed ; Jump if not       }
  23.           $40/                          { inc ax           ; Skip over op code }
  24.           $89/$c7/                      { mov di,ax        ; Set up for LES    }
  25.           $26/$c4/$05/                  { les ax,es:[di]   ; Get data address  }
  26.           $8c/$c2);       { NotOverlayed: mov dx,es        ; Return it in DX:AX}
  27.  
  28. implementation
  29.  
  30. end.
  31.